{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2011_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}10 Oct 2021, 14:24:02

{com}. do "C:\Users\JUNGYE~1\AppData\Local\Temp\STD3644_000000.tmp"
{txt}
{com}. import delimited "C:\Users\Jungyeon PARK\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\FEVS\FEVS_2010-2019\FEVS2011_PRDF.csv
{res}{text}(98 vars, 266,376 obs)

{com}. 
. svyset [pweight=postwt]

      {txt}pweight:{col 16}{res}postwt
          {txt}VCE:{col 16}{res}linearized
  {txt}Single unit:{col 16}{res}missing
     {txt}Strata 1:{col 16}<one>
         SU 1:{col 16}<observations>
        FPC 1:{col 16}<zero>
{p2colreset}{...}

{com}. 
. drop if q17=="X"
{txt}(11,875 observations deleted)

{com}. 
. drop if q17==""
{txt}(1,046 observations deleted)

{com}. 
. drop if q37=="X"
{txt}(10,292 observations deleted)

{com}. 
. drop if q37==""
{txt}(5,559 observations deleted)

{com}. 
. drop if q38=="X"
{txt}(8,929 observations deleted)

{com}. 
. drop if q38==""
{txt}(1,272 observations deleted)

{com}. 
. destring q17, replace
{txt}q17: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q37, replace
{txt}q37: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q38, replace
{txt}q38: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. svy linearized : gsem (FAIRNESS -> q17, family(ordinal) link(logit)) (FAIRNESS -> q37, family(ordinal) link(logit)) (FAIRNESS -> q38, family(ordinal) link(logit)), covstruct(_lexogenous, diagonal) latent(FAIRNESS) nocapslatent
{txt}(running gsem on estimation sample)
{res}
{txt}Survey: Generalized structural equation model

{col 1}Number of strata{col 20}= {res}        1{txt}{col 49}Number of obs{col 67}= {res}   227,403
{txt}{col 1}Number of PSUs{col 20}= {res}  227,403{txt}{col 49}Population size{col 67}={res}  1,559,514
{txt}{col 49}Design df{col 67}= {res}   227,402

{txt}Response{col 16}: {res}q17
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q37
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q38
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{p 0 7}{space 1}{text:( 1)}{space 1} [q17]FAIRNESS = 1{p_end}
{txt}{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}  Linearized
{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q17           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2}        1{col 27}{txt}  (constrained)
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q37           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 1.852245{col 27}{space 2} .0298303{col 38}{space 1}   62.09{col 47}{space 3}0.000{col 55}{space 4} 1.793778{col 68}{space 3} 1.910711
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q38           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 2.058468{col 27}{space 2} .0395367{col 38}{space 1}   52.06{col 47}{space 3}0.000{col 55}{space 4} 1.980977{col 68}{space 3} 2.135959
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q17          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-3.501791{col 27}{space 2} .0235433{col 55}{space 4}-3.547935{col 68}{space 3}-3.455647
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.344971{col 27}{space 2}  .017783{col 55}{space 4}-2.379826{col 68}{space 3}-2.310117
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.8504023{col 27}{space 2}  .013619{col 55}{space 4}-.8770953{col 68}{space 3}-.8237093
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 1.741498{col 27}{space 2} .0164691{col 55}{space 4} 1.709219{col 68}{space 3} 1.773777
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q37          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-4.774956{col 27}{space 2} .0550597{col 55}{space 4}-4.882871{col 68}{space 3} -4.66704
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.934902{col 27}{space 2} .0376873{col 55}{space 4}-3.008769{col 68}{space 3}-2.861036
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.4538121{col 27}{space 2} .0206864{col 55}{space 4} -.494357{col 68}{space 3}-.4132672
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 3.753349{col 27}{space 2}  .044845{col 55}{space 4} 3.665454{col 68}{space 3} 3.841244
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q38          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-6.441626{col 27}{space 2} .0900883{col 55}{space 4}-6.618197{col 68}{space 3}-6.265056
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-4.742993{col 27}{space 2} .0686305{col 55}{space 4}-4.877507{col 68}{space 3}-4.608479
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-1.856975{col 27}{space 2} .0341427{col 55}{space 4}-1.923894{col 68}{space 3}-1.790056
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 2.975639{col 27}{space 2} .0446586{col 55}{space 4} 2.888109{col 68}{space 3} 3.063168
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}var(FAIRNESS){c |}{col 15}{res}{space 2} 3.537571{col 27}{space 2}  .066467{col 55}{space 4} 3.409667{col 68}{space 3} 3.670273
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. predict fairnessgsem, latent(FAIRNESS)
{txt}(option {bf:ebmeans} assumed)
{res}{txt}(using 7 quadrature points)

{com}. 
. egen average_fairnessgsem = mean (fairnessgsem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnessgsem = mean (fairnessgsem), by (subelem)
{txt}
{com}. 
. svy linearized : sem (FAIRNESSSEM -> q38 q37 q17), covstruct(_lexogenous, diagonal) standardized latent(FAIRNESSSEM) nocapslatent
{txt}(running sem on estimation sample)
{res}
{txt}{col 1}Survey: Structural equation model{col 49}Number of obs{col 67}= {res}   227,403
{txt}{col 1}Number of strata{col 22}= {res}        1{txt}{col 49}Population size{col 67}={res}  1,559,514
{txt}{col 1}Number of PSUs{col 22}= {res}  227,403{txt}{col 49}Design df{col 67}= {res}   227,402

{p 0 7}{space 1}{text:( 1)}{space 1} [q38]FAIRNESSSEM = 1{p_end}
{txt}{hline 16}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 17}{c |}{col 29}  Linearized
{col 1}   Standardized{col 17}{c |}      Coef.{col 29}   Std. Err.{col 41}      t{col 49}   P>|t|{col 57}     [95% Con{col 70}f. Interval]
{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}{res}Measurement    {col 17}{txt}{c |}
{space 2}{col 3}q38          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .8435442{col 29}{space 2} .0028473{col 40}{space 1}  296.26{col 49}{space 3}0.000{col 57}{space 4} .8379636{col 70}{space 3} .8491248
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 3.426856{col 29}{space 2} .0144131{col 40}{space 1}  237.76{col 49}{space 3}0.000{col 57}{space 4} 3.398606{col 70}{space 3} 3.455105
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q37          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .8438971{col 29}{space 2} .0028898{col 40}{space 1}  292.02{col 49}{space 3}0.000{col 57}{space 4} .8382331{col 70}{space 3} .8495611
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 2.816589{col 29}{space 2} .0098264{col 40}{space 1}  286.63{col 49}{space 3}0.000{col 57}{space 4}  2.79733{col 70}{space 3} 2.835849
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q17          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .6789054{col 29}{space 2} .0035962{col 40}{space 1}  188.78{col 49}{space 3}0.000{col 57}{space 4} .6718569{col 70}{space 3} .6859539
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 3.059097{col 29}{space 2}  .011593{col 40}{space 1}  263.87{col 49}{space 3}0.000{col 57}{space 4} 3.036375{col 70}{space 3} 3.081819
{txt}{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}var(e.q38){c |}{col 17}{res}{space 2} .2884332{col 29}{space 2} .0048036{col 57}{space 4} .2791703{col 70}{space 3} .2980035
{txt}{space 6}var(e.q37){c |}{col 17}{res}{space 2} .2878376{col 29}{space 2} .0048774{col 57}{space 4}  .278435{col 70}{space 3} .2975578
{txt}{space 6}var(e.q17){c |}{col 17}{res}{space 2} .5390875{col 29}{space 2}  .004883{col 57}{space 4} .5296013{col 70}{space 3} .5487435
{txt}var(FAIRNESSSEM){c |}{col 17}{res}{space 2}        1{col 29}{space 2}        .{col 57}{space 4}        .{col 70}{space 3}        .
{txt}{hline 16}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. estat gof, stats(all)
{res}
{txt}{hline 21}{c TT}{hline 54}
{lalign 21:Fit statistic}{c |}      Value   Description
{hline 21}{c +}{hline 54}
{lalign 21:Size of residuals}{c |}
{ralign 20:SRMR} {c |} {res}{ralign 10:     0.000}{txt}   Standardized root mean squared residual
{ralign 20:CD} {c |} {res}{ralign 10:     0.853}{txt}   Coefficient of determination
{hline 21}{c BT}{hline 54}
{p 0 2 2 75}Note: model was fit with{txt} svy: prefix; only stats(residuals) valid.{p_end}

{com}. 
. predict fairnesssem, latent(FAIRNESSSEM)
{res}{txt}
{com}. 
. egen average_fairnesssem = mean (fairnesssem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnesssem = mean (fairnesssem), by (subelem)
{txt}
{com}. 
. correlate fairnessgsem fairnesssem
{txt}(obs=227,403)

             {c |} fai~gsem fai~ssem
{hline 13}{c +}{hline 18}
fairnessgsem {c |}{res}   1.0000
 {txt}fairnesssem {c |}{res}   0.9813   1.0000

{txt}
{com}. 
{txt}end of do-file

{com}. save "C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2011_FEVS_DATA.dta"
{txt}file C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2011_FEVS_DATA.dta saved

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2011_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}10 Oct 2021, 14:27:23
{txt}{.-}
{smcl}
{txt}{sf}{ul off}